<?php
    //Lấy node type đối tác
    $opt = array(
        'conditions' => array('NodeType.id' => 2),
        'fields' => array('NodeType.id','NodeType.name'),
        'locale' => true,
        'find' => 'first'
    );    
    $nodeType = $this->String->get_data('Node','NodeType',$opt);
    //Lay danh sach slide
    $content = array();
    $condsDefault = $this->String->condsDefault();
    $condsDefault = array_merge($condsDefault,array('Node.node_type_id' => 2));
    $fields = $this->String->nodeFields();
    $order = $this->String->orderFields();
    $opt = array(
        'conditions' => $condsDefault,
        'find' => 'all',
        'fields' => $fields,
        'locale' => true,
        'order' => array('Node.created' => 'asc')
    );
    $content = $this->String->get_data('Node','Node',$opt);
    $k = 1;$arrNew = array();
    $i = 0;
    if(!empty($content)){
        foreach($content as $key => $values){
            if($i%3==0) $k++;
            $arrNew[$k][] = $values;
            $i++; 
        }
    }
?>
<div class="tabpanel-cus" role="tabpanel">
    <!-- Nav tabs -->
    <ul class="nav nav-tabs mytabs-cus mytabs-nbdcus">
        <li class="item item-onl-tab active"><a href="#item-11" data-toggle="tab"><?php echo $nodeType['NodeType']['name'];?></a></li>
    </ul>
    <!-- Tab panes -->
    <div class="tab-content">
        <div class="tab-pane tab-pane-bgtop fade in active" id="item-11">
            <div class="tabs-pane-content-full asbl-rct-cus-slide">
                <div class="flexslider flexslider-cal">
                    <ul class="slides">
                        <?php if(!empty($arrNew)):?>
                            <?php foreach($arrNew as $key => $values):?>
                                <li>
                                    <ul class="grid-news row">
                                        <?php foreach($values as $childKey => $childValues):?>
                                            <?php 
                                                if((!empty($childValues['Node']['field_image_default']))&&(file_exists(WWW_ROOT . '/img/' . $childValues['Node']['field_image_default'])))
                                                {
                                                    $thumb_pro = $this->Image->make_thumb($childValues['Node']['field_image_default'],WWW_ROOT . '/img/','180','90');
                                                }
                                                else
                                                {
                                                    $thumb_pro = $this->Image->make_thumb('no_image.jpg',WWW_ROOT.'/img/','180','90');
                                                }
                                            ?>
                                            <li class="col-xs-4 col-sm-4 col-md-4 col-lg-4 grid-news-item">
                                                <a href="<?php echo $this->Html->url(array('plugin'=>'View','controller'=>'View','action'=>'project',$childValues['Node']['alias']));?>" class="thumbnail-content">
                                                    <span class="image-ct">
                                                        <img src="<?php echo $this->Html->webroot('/img/' . $thumb_pro);?>" alt="du an" height="86" width="179">
                                                    </span>
                                                    <span class="caption-content">
                                                        <span class="title"><?php echo String::truncate($childValues['Node']['title'],25);?></span>
                                                        <span class="desc-text"><?php echo String::truncate($childValues['Node']['field_description'],60);?></span>
                                                    </span>
                                                </a>
                                            </li>
                                            <?php endforeach;?>
                                    </ul>
                                </li>
                                <?php endforeach;?>
                            <?php endif;?>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>